package com.byzoro.controller;

import com.byzoro.service.UsersService;
import com.byzoro.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@Component
@Controller
@Slf4j
public class LoginController {
    @Autowired
    UsersService usersService;

    @ResponseBody
    @PostMapping("api/login")
    public JsonResult login (@RequestBody Map<String, String> map) {
        return usersService.login(map.get("name"), map.get("password"));
    }
}
